#!/bin/bash

set -e -x

go install \
	github.com/dvyukov/go-fuzz/go-fuzz \
	github.com/dvyukov/go-fuzz/go-fuzz-build \
	github.com/fuzzitdev/fuzzit/v2

export GOFUZZ111MODULE=on
go-fuzz-build -libfuzzer -o fuzzit-program.a .
clang -fsanitize=fuzzer fuzzit-program.a -o fuzzit-program

fuzzit create job --type ${1} mvdan/sh-syntax-parser-printer fuzzit-program

rm -f fuzzit-program.a fuzzit-program
